<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
	</head>
	<body>
<!-- 		<form action="#" method="post">
 -->		<div >
				<label for="year">请输入要判定的年份</label>
				<input id="year" type="text" name="year">
			</div>
			<input id="check" type="submit" value="判定"/>
		<!-- </form> -->
		
		<div class="result">
			
		</div>
		
		<script type="text/javascript">
			let btn = document.getElementById('check');//获取按钮
			btn.onclick = function(){
				let input = document.getElementById('year');//输入框元素
				// alert(typeof input.value)
				let year = + input.value; // 将string 转换为num
				
				let result = !year ? '格式不正确' : 	 
					(year%400 == 0 || ( year%4 == 0  && year%100 != 0) ? '闰年' : '平年' );
				
				let resultEle = document.getElementsByClassName('result')[0];
				resultEle.innerHTML = result;
				
			}
		</script>
	</body>
</html>
